﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Course : System.Web.UI.Page
{
    db_course course = new db_course();
    db_courseware cw = new db_courseware();
    public string courseName = "";
    public string courseAbout = "";
    public string courseHour = "";
    public string courseGold = "";
    
    protected void Page_Load(object sender, EventArgs e)
    {
        

        //if (Request.QueryString["id"] == null)
        //{
        //    Response.Redirect("index.aspx");
        //}
        DataSet ds = new DataSet();
        string courseID = Request.QueryString["id"];
        ds = course.selectCourseInfo_id(courseID);
        
        if (ds.Tables[0].Rows.Count == 0 || "1".Equals(ds.Tables[0].Rows[0]["status"].ToString()))
        {
            Response.Write("<script language=javascript>alert('找不到数据！');</script>");
            return;
        }
        else
        {
            string kind = ds.Tables[0].Rows[0]["coursetype"].ToString();
            if (kind.Equals("Java"))
            {
                Response.Redirect("CourseJava.aspx?id=" + courseID);
                //Server.Transfer("newsShowa.aspx?id=" + newsID);
            }
            else if (kind.Equals("C#"))
            {
                Response.Redirect("CourseNet.aspx?id=" + courseID);
            }
            else if (kind.Equals("DataBase"))
            {
                Response.Redirect("CourseDataBase.aspx?id=" + courseID);
            }
            else if (kind.Equals("Other"))
            {
                Response.Redirect("CourseOther.aspx?id=" + courseID);
            }
            else
            {
                Response.Write("<script language=javascript>alert('出错！');</script>");
                Response.Redirect("index.aspx");
            }
        }
        

    }
}